package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 前端显示订单状态(1 - 待支付, 2 - 待核销, 3 - 已完成, 4 - 已关闭)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum FrontOrderStateEnum {

    WAIT_PAY(1, "待支付"),
    WAIT_VERIFY(2, "待核销"),
    FINISH(3, "已完成"),
    CLOSE(4, "已关闭"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    FrontOrderStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static FrontOrderStateEnum typeOf(Integer value) {
        FrontOrderStateEnum[] values = FrontOrderStateEnum.values();
        for (FrontOrderStateEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static FrontOrderStateEnum typeOf(String name) {
        FrontOrderStateEnum[] values = FrontOrderStateEnum.values();
        for (FrontOrderStateEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
